import 'package:dio/dio.dart';

class HeaderInterceptor extends InterceptorsWrapper {
  @override
  onRequest(RequestOptions options, RequestInterceptorHandler handler) async {
    //仿写项目里不知道为啥要加async，我认为只有在需要异步时可以加，这里根本没必要
    //在请求前触发
    options.connectTimeout = const Duration(seconds: 30);
    options.receiveTimeout = const Duration(seconds: 30);
    options.contentType = 'application/json';

    return super.onRequest(options, handler);
  }
}
